package com.ruoyi.property.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.property.domain.PayFeeAuditManageInfo;
import com.ruoyi.property.service.IPayFeeAuditManageInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 缴费审核Controller
 * 
 * @author sux
 * @date 2021-06-30
 */
@Controller
@RequestMapping("/property/payFeeAuditManageInfo")
public class PayFeeAuditManageInfoController extends BaseController
{
    private String prefix = "property/payFeeAuditManageInfo";

    @Autowired
    private IPayFeeAuditManageInfoService payFeeAuditManageInfoService;

    @RequiresPermissions("property:payFeeAuditManageInfo:view")
    @GetMapping()
    public String payFeeAuditManageInfo()
    {
        return prefix + "/payFeeAuditManageInfo";
    }

    /**
     * 查询缴费审核列表
     */
    @RequiresPermissions("property:payFeeAuditManageInfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PayFeeAuditManageInfo payFeeAuditManageInfo)
    {
        startPage();
        List<PayFeeAuditManageInfo> list = payFeeAuditManageInfoService.selectPayFeeAuditManageInfoList(payFeeAuditManageInfo);
        return getDataTable(list);
    }

    /**
     * 导出缴费审核列表
     */
    @RequiresPermissions("property:payFeeAuditManageInfo:export")
    @Log(title = "缴费审核", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(PayFeeAuditManageInfo payFeeAuditManageInfo)
    {
        List<PayFeeAuditManageInfo> list = payFeeAuditManageInfoService.selectPayFeeAuditManageInfoList(payFeeAuditManageInfo);
        ExcelUtil<PayFeeAuditManageInfo> util = new ExcelUtil<PayFeeAuditManageInfo>(PayFeeAuditManageInfo.class);
        return util.exportExcel(list, "payFeeAuditManageInfo");
    }

    /**
     * 新增缴费审核
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存缴费审核
     */
    @RequiresPermissions("property:payFeeAuditManageInfo:add")
    @Log(title = "缴费审核", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(PayFeeAuditManageInfo payFeeAuditManageInfo)
    {
        return toAjax(payFeeAuditManageInfoService.insertPayFeeAuditManageInfo(payFeeAuditManageInfo));
    }

    /**
     * 修改缴费审核
     */
    @GetMapping("/edit/{auditId}")
    public String edit(@PathVariable("auditId") Long auditId, ModelMap mmap)
    {
        PayFeeAuditManageInfo payFeeAuditManageInfo = payFeeAuditManageInfoService.selectPayFeeAuditManageInfoById(auditId);
        mmap.put("payFeeAuditManageInfo", payFeeAuditManageInfo);
        return prefix + "/edit";
    }

    /**
     * 修改保存缴费审核
     */
    @RequiresPermissions("property:payFeeAuditManageInfo:edit")
    @Log(title = "缴费审核", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(PayFeeAuditManageInfo payFeeAuditManageInfo)
    {
        return toAjax(payFeeAuditManageInfoService.updatePayFeeAuditManageInfo(payFeeAuditManageInfo));
    }

    /**
     * 删除缴费审核
     */
    @RequiresPermissions("property:payFeeAuditManageInfo:remove")
    @Log(title = "缴费审核", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(payFeeAuditManageInfoService.deletePayFeeAuditManageInfoByIds(ids));
    }
}
